import request from '@/utils/http'
import { BaseResult } from '@/types/axios'

export class AccountService {
  // 绑定小红书-1.获取小红书授权地址
  static getAuthUrl(params?: any) {
    return request.get<BaseResult>({
      url: '/user/account_xhs/getAuthUrl',
      params
    })
  }

  // 绑定小红书-2.确认授权
  static getCallbackAuth(params: object) {
    return request.get<BaseResult>({
      url: '/user/account_xhs/callbackAuth',
      params
    })
  }

  // 绑定小红书-3.获取小红书绑定地址
  static getBindUrl(account_id: string | number) {
    return request.get<BaseResult>({
      url: '/user/account_xhs/getBindUrl',
      params: { account_id }
    })
  }

  // 分页获取账号列表
  static getPage(params?: object) {
    return request.get<BaseResult>({
      url: '/user/account/page',
      params
    })
  }

  // 删除账号
  static delAccount(params: object) {
    return request.post<BaseResult>({
      url: '/user/account/delete',
      data: params
    })
  }
}

export class GroupService {
  // 分页获取账号分组列表
  static getGroupPage(params?: object) {
    return request.get<BaseResult>({
      url: '/user/account_group/page',
      params
    })
  }

  // 删除账号分组
  static groupDelete(data: object) {
    return request.post<BaseResult>({
      url: '/user/account_group/delete',
      data
    })
  }

  // 新增账号分组
  static groupCreate(data: object) {
    return request.post<BaseResult>({
      url: '/user/account_group/create',
      data
    })
  }

  // 更新账号分组
  static groupUpdate(data?: object) {
    return request.post<BaseResult>({
      url: '/user/account_group/update',
      data
    })
  }
}
